home *** CD-ROM | disk | FTP | other *** search
- class MiniGames.JFS.JellyFishSwarmMG extends MiniGames.BaseMiniGame
- {
- var nNbJellyFish;
- var oPatrick;
- var mcRef;
- var aJellyFishes;
- var sState;
- var bOver;
- static var sSTATE_NORMAL = "Normal";
- static var sSTATE_WHACKY = "Whacky";
- static var nMAX_TIME = 24;
- static var nSECOND_VALUE = 100;
- static var nBUFFER_TIME = 10;
- function JellyFishSwarmMG(_mcRef)
- {
- super(_mcRef);
- this.nNbJellyFish = 0;
- this.showInstructions();
- }
- function initMiniGame()
- {
- this.oPatrick = new MiniGames.JFS.JFSPatrick(this.mcRef.mcState.mcPatrick);
- this.aJellyFishes = new Array();
- for(var i in this.mcRef.mcState.mcContainer)
- {
- this.aJellyFishes.push(new MiniGames.JFS.JFSJellyFish(this.mcRef.mcState.mcContainer[i],this));
- this.nNbJellyFish = this.nNbJellyFish + 1;
- }
- }
- function setState(_sState)
- {
- super.setState(_sState);
- if(this.sState == MiniGames.BaseMiniGame.sSTATE_MINIGAME || this.sState == MiniGames.BaseMiniGame.sSTATE_VICTORY)
- {
- if(Main.getRef().isCheatClothesActivated())
- {
- this.mcRef.mcState.gotoAndStop(MiniGames.JFS.JellyFishSwarmMG.sSTATE_WHACKY);
- }
- else
- {
- this.mcRef.mcState.gotoAndStop(MiniGames.JFS.JellyFishSwarmMG.sSTATE_NORMAL);
- }
- }
- else if(Main.getRef().isCheatClothesActivated())
- {
- this.mcRef.mcBack.gotoAndStop(MiniGames.JFS.JellyFishSwarmMG.sSTATE_WHACKY);
- }
- else
- {
- this.mcRef.mcBack.gotoAndStop(MiniGames.JFS.JellyFishSwarmMG.sSTATE_NORMAL);
- }
- }
- function doUnPause()
- {
- super.doUnPause();
- this.mcRef.stop();
- this.mcRef.mcBack.stop();
- if(this.sState == MiniGames.BaseMiniGame.sSTATE_MINIGAME || this.sState == MiniGames.BaseMiniGame.sSTATE_VICTORY)
- {
- this.mcRef.mcState.stop();
- }
- }
- function validateEndMiniGame()
- {
- if(this.nNbJellyFish == 0 && this.sState == MiniGames.BaseMiniGame.sSTATE_MINIGAME)
- {
- this.setVictory();
- }
- }
- function destroyMiniGame()
- {
- super.destroyMiniGame();
- for(var i in this.aJellyFishes)
- {
- this.aJellyFishes[i].cleanUp();
- }
- this.oPatrick.cleanUp();
- }
- function calculateScore()
- {
- this.addScoreFromTimeLeft(MiniGames.JFS.JellyFishSwarmMG.nMAX_TIME,MiniGames.JFS.JellyFishSwarmMG.nSECOND_VALUE);
- }
- function decreaseJellyFishCount()
- {
- if(this.nNbJellyFish > 0)
- {
- this.nNbJellyFish = this.nNbJellyFish - 1;
- }
- }
- function takeHook(_oJelly)
- {
- this.oPatrick.takeHook(_oJelly);
- }
- function MiniGame()
- {
- super.MiniGame();
- }
- function Victory()
- {
- if(this.mcRef.mcState.mcState._currentframe == this.mcRef.mcState.mcState._totalframes - MiniGames.JFS.JellyFishSwarmMG.nBUFFER_TIME)
- {
- this.bOver = true;
- }
- }
- }
-